package top.maof.book.map;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import top.maof.book.model.User;
import top.maof.book.vo.UserVo;

@Mapper
public interface UserMap {

    UserMap INSTANCE = Mappers.getMapper(UserMap.class);

    @Mappings({
            @Mapping(source = "user.id", target = "id"),
            @Mapping(source = "user.username", target = "username"),
            @Mapping(source = "user.nickname", target = "nickname"),
            @Mapping(source = "user.img", target = "img")
    })
    UserVo toUserVo(User user);
}
